package com.scalar.forecast.utils;

import com.scalar.chiptrack.utils.ConfigManager;

import java.util.Properties;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.IOException;

/**
 * Created by Veeru. 
 * Date: Feb 11, 2004
 * Time: 10:22:33 AM 
 */

public final class ForecastSqlQueryMappings {

    private static Properties s_props = new Properties();

    static
    {
        String queryMappingFile = null;
        InputStream in = null;

        try
        {
            queryMappingFile = ConfigManager.getForecastSqlQueryMappingFile();
            in = new FileInputStream( queryMappingFile );
            s_props.load( in );
        }
        catch( Exception e )
        {
            System.out.println( "Failed to load Forecast SQL Query mappings file, please check \"scalar.properties\" file" );
            e.printStackTrace();
        }
        finally
        {
            if( in != null )
            {
                try
                {
                    queryMappingFile = null;
                    in.close();
                }
                catch( IOException ignore ) { }
            }
        }
    }
    public static String get( String key )
    {
        return s_props.getProperty( key );
    }

    private ForecastSqlQueryMappings()
    {
    }

}
